<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="../taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link  rel="stylesheet" type="text/css" href="css/four.css"/>
    <link rel="stylesheet" type="text/css" href="css/jqe/themes/default/easyui.css"/>
	<link rel="stylesheet" type="text/css" href="css/jqe/themes/icon.css"/>

    <script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>
	<script type="text/javascript" src="js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        $(function(){
        	 //初始化对话框
        	   $('#dw,#dwEdit,#dwRead').window({
        		   onBeforeClose:function(){ 
        			   //取消时关闭等待框
        			   setTimeout(function(){ 
        				   sending.style.visibility = "hidden";
					   }, 250);
        	   }});
        	
       
              $(".btnAll").each(function(i,v){
        	   //变手型
        	     $(v).mouseover(function() {
    				$(this).css("cursor", "hand");
    			 }).mouseout(function() {
    				$(this).css("cursor", "pointer");
    			 });
        	   
        	   
        	   if($(v).html()=='【新增】'){
        		   $(v).click(function(){
        			   $('#dw').window("open");
        		   });
        	   }else if($(v).html()=='【编辑】'){
        		   $(v).click(function(){
        			   //ajax
        			  /*  $.get("ajOneCou.do?kcid="+ $(v).prop("lang")+"&x="+Math.random(),function(jsonTxt){
        				   var jsonObj = eval("("+jsonTxt+")");
        				   $("#upd_kcid").val(jsonObj.kcid);
        				   $("#upd_kcname").val(jsonObj.kcname);
        				   $("#upd_kcdesc").html(jsonObj.kcdesc);
        				   $('#dwEdit').window("open");
        			   }); */
        			   
        			   $.ajax({
        				   type:"POST",
        				   url:"ajOneStu.do",
        				   data:"studentid="+ $(v).prop("lang")+"&time="+new Date().getTime(),
        				   success:function(msg){
        					   if(msg.head='ok'){
        						   $("#upd_sid").val(msg.body.studentid);
        						   $("#upd_snum").val(msg.body.snumber);
        						   $("#upd_sname").val(msg.body.name);
                				   $("#upd_sclass").val(msg.body.sclass);
                				   $('#dwEdit').window("open");
        					   }
        				   }
 
        			   });
        			   
        		   });
        	   }else if($(v).html()=='【删除】'){
        		   $(v).click(function(){
        			  if(confirm("确认删除'"+$(v).prop("title")+"'?")){
        				  location.href="delStu.do?studentid="+$(v).prop("lang"); 
        			  }
        		   });
        	   }else if($(v).html()=='【查看】'){
        		   $(v).click(function(){
        			   $.ajax({
        				   type:"POST",
        				   url:"ajOneStu.do",
        				   data:"studentid="+ $(v).prop("lang")+"&time="+new Date().getTime(),
        				   success:function(msg){
        					   if(msg.head='ok'){
                				   $("#rnum").html(msg.body.snumber);
                				   $("#name").html(msg.body.name);
                				   $("#rcla").html(msg.body.sclass);
                				   $('#dwRead').window("open");
        					   }
        				   }
        			   });
        		   })
        	   }
           }); 
        });
    </script>
</head>
<body>
	<!-- 包含等待框 -->
	<jsp:include page="../waittable.jsp" flush="true" />
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr valign="top">
			<td bgcolor="#FFFFFF"><table width="96%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#aec3de">
					<tr align="left" bgcolor="#F2FDFF">
						<td colspan="6" class="optiontitle">学生列表</td>
					</tr>
					<tr align="center">
					    
					    <td align="center" bgcolor="#ebf0f7">学生学号</td>
						<td align="center" bgcolor="#ebf0f7">学生名字</td>
						<td align="center" bgcolor="#ebf0f7">班级</td>
						
						<td align="center" bgcolor="#ebf0f7">操作 <span class="btnAll">【新增】</span> <span >【批量删除】</span></td>
					</tr>             
					
					<c:forEach items="${page.results}" var="stu">
						<tr align="center" bgcolor="#FFFFFF">
						  
						    <td align="center" >${stu.snumber}</td>
							<td align="center">${stu.name}</td>
							<td align="center">${stu.sclass}</td>
							<td align="center">
									<span class="btnAll" lang="${stu.studentid }" >【查看】</span>
									| <span class="btnAll" lang="${stu.studentid }">【编辑】</span>
								    | <span class="btnAll" lang="${stu.studentid }" title="${stu.name }这名同学">【删除】</span>
				                  
							</td>
						</tr>
					</c:forEach>
					<tr align="right" bgcolor="#ebf0f7">
							<td colspan="6">
						<df:page totalPage="${page.totalPage}" pageNo="${page.pageNo}" totalRecord="${page.totalRecord}"
                                url="listEmp.do" />
							</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
		  <td align="center" style="color: red">${msg}</td>
		</tr>
	</table>
	<div id="dwRead" class="easyui-window" title="查看学生信息" data-options="modal:true,minimizable:false,closed:true,maximizable:false,iconCls:'icon-save'" style="width:300px;height:200px;padding:10px;display: none;">
		 
		     
		     学生学号:<span id="rnum"></span><br/><br/>
		       学生姓名:<span id="name"></span><br/><br/>
		       学生班级:<span id="rcla"></span><br/><br/>
		     
	</div>
  
	<div id="dw" class="easyui-window" title="添加学员" data-options="modal:true,minimizable:false,closed:true,maximizable:false,iconCls:'icon-save'" style="width:300px;height:200px;padding:10px;display: none;">
		<form action="addStu.do" method="post">
		    学生姓名：<input name="name"/><br/><br/>
		  学生学号:<input name="snumber"/><br/><br/>
		     班级：<input name="sclass" /><br/><br/>
		      <input type="submit" value="保存"/><br/>
		</form>
	</div>
	
	 <div id="dwEdit" class="easyui-window" title="修改学员信息" data-options="modal:true,minimizable:false,closed:true,maximizable:false,iconCls:'icon-save'" style="width:300px;height:200px;padding:10px;display: none;">
		<form action="updStu.do" method="post">
		<input name="studentid" id="upd_sid" type="hidden"   />
		<input name="snumber" id="upd_snum" type="hidden"   />
		     学员姓名：<input name="name" id="upd_sname"   /><br/><br/>
		     班级 ：<input name="sclass" id="upd_sclass"/><br/><br/>
		       <input type="submit" value="修改"/><br/>
		</form>
	</div>
	
</body>
</html>